/*
 * codename: xEngine
 * Copyright (C) Aljosa Osep <aljosa.osep@gmail.com>
 * 
 * Based on xSoko engine (C) Aljosa Osep, Jernej Skrabec, Jernej Halozan, Martin Savc 2008 <aljosa.osep@gmail.com, jernej.skrabec@gmail.com, jernej.halozan@gmail.com, martin.savc@gmail.com>
 *
 * xEngine project is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * xEngine project is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* 
 * Codename: xEngine
 * File: engine.h
 *
 * Summary:
 * Includes game core class definition
 *
 * Author: Aljosa Osep 2007
 * Changes:
 * Aljosa May 28 2008
 * Jernej October 5 2008
 */

#ifndef __ENGINE_H
#define __ENGINE_H



#include "renderer/renderer.h" // TODO: do renderer singleton, remove this
#include "gui/gui.h"
#include "gui/window.h"

#include "zip/zipfile.h"
#include <boost/filesystem.hpp>

// Main subsystems
#include "SoundManager.h"
#include "camera.h"
#include "input.h"
#include "messages.h"

using namespace boost::filesystem;
//using namespace xEngine::RenderMaschine; // TODO: remove

namespace xEngine
{
      namespace CoreSystem
      {
          // Game forward declaration
          class Game;

            /**********************************************************
           * Engine
           *
           * Represents a whole window and game main functions
           * --------------------------------------------------------
           * Aljosa 2007
           * ********************************************************/
          class Engine {
          private:
              // Window stuff
              int windowWidth;
              int windowHeight;
              bool fullscreen;
              string windowTitle;

              // bool gamepack
              // string pack;
              string homepath; // Home directory path; OS specific

              // PCamera *camera; // Should be a matter of game, REMOVE

              xEngine::GameClasses::PInputSystem input; // TODO FIX

              // Matter of game?
              bool isAppRunning;
              bool gameQuit;
              bool forceLevelQuit;

              // GUI components
              Window* mainMenu;
              Window* gameMenu;

              Game *application;

              // SoundManager sm;
          
              // constructor
              Engine();

          public:
              bool init(int _width, int _height, string _title/*, Game *app*/);
              void mainLoop();
              void quit();
              void setResolution(int width, int height, bool fullscreen);
              void setApplication(Game *app);
              void terminate();

              void loadLevel(string levelPath);
              void loadApp(string name);
              // void loadGamePack(string packPath);
              void exitLevel();
              void resetLevel();

     //         SoundManager* getSoundManagerInstance();

              //getters
              static Engine& getInstance();

          };       
      }       
}

#endif
